//////////////////////////////////////////
//vps,fps
//////////////////////////////////////////
@script AddComponentMenu("Level4/Misc/VpsFps")
private var mesh:Mesh;

/** 帧数(s) */
var showFps:boolean;
/** 顶点数(s) */
var showVps:boolean;

function Start(){
	mesh = FindObjectOfType(Mesh);
	if(!guiText)
		gameObject.AddComponent(GUIText);
	guiText.material.color = Color.red;
	guiText.transform.position = Vector3(0.8,0.14,0);
}

function LateUpdate(){
	var result:String = "";
	var time:float = Time.smoothDeltaTime;
		time = time == 0 ? 1 : time;
	if(mesh && showVps){
		var vps:int = mesh.vertexCount / time;
		result += "Vps:"+vps;
	}
	if(showFps){
		var fps:int = 1.0 / time;
		result += "Fps:"+fps;
	}
	guiText.text = result;
}